// TypeScript file
module Fighter {

    /**
     * 我方攻击UI--郭启航
     */
    export class AirBattleUI extends eui.Component {
        constructor() {
            super();
            this.skinName = "resource/assets/PlaneE/GameUI.exml";
            this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
            this.addEventListener(egret.Event.REMOVED_FROM_STAGE, this.removeFromStage, this);
            //this.joystick = new fighter.Joystick(this.Gan, this.Huan);
        }

        /**摇杆 */
        public Gan: eui.Image;
        /**摇杆的环 */
        public Huan: eui.Image;
        /**波次*/
        private Game_degree: eui.BitmapLabel;
        /**金币*/
        private Game_MoneyShow: eui.BitmapLabel;
        /**该回合剩余飞机数 */
        private Game_Enemy_Num: eui.Label;
        /**橙色底板*/
        private DiBan: eui.Image;
        /**播放*/
        public PlayMusic: boolean = false;

        /**摇杆 */
        //public joystick: fighter.Joystick;
        /** 添加声音 */
        public onAddToStage() {

            this.Game_degree.text = GameUtil.PlayerMessage.instance.game_turns.toString();
            //this.addChild(this.joystick);
            //this.joystick.Game_joystick(this.Gan, this.Huan);
            if (!this.PlayMusic) {
                this.PlayMusic = true;
                var micse: Music = new Music();
                micse.Play("music_mp3");
            }

            this.addEventListener(egret.Event.ENTER_FRAME, this.Show, this);
        }
        /**每帧更新提示信息*/
        public Show() {
            this.Game_MoneyShow.text = GameUtil.PlayerMessage.instance.money.toString();
            if (GameUtil.PlayerMessage.instance.AllPlaneCount <= 0) {
                GameUtil.PlayerMessage.instance.AllPlaneCount = 0; 
            }
            this.Game_Enemy_Num.text = "X" + GameUtil.PlayerMessage.instance.AllPlaneCount.toString();

        }
        /**离开舞台 */
        private removeFromStage() {
            this.removeEventListener(egret.Event.ENTER_FRAME, this.Show, this);
            //this.removeChild(this.joystick);
            //PlayerMsg.instance.time = 10;
            //SceneManager.countDown.stop();
        }
    }

}